Refactor API allowedValues to derive values from enums - #13895
Refactor API allowedValues to derive values from enums#13895dheeraj12347 wants to merge 8 commits into
Conversation
|
Hi @Pearl1594 and @soreana , I’ve opened PR #13895 with the updated allowedValues implementation. I incorporated the work from #13783 into this branch and addressed the hard-coded enum concern by adding allowedValueType to @parameter and deriving the values from the enum constants during API discovery. I’ve also retained the existing explicit allowedValues path for parameters where there is no corresponding enum, and added test coverage for both paths. I’ve verified the implementation with the API Discovery build, the API Discovery tests (8/8 passing), git diff --check, and checkstyle. Regarding your earlier request to merge #13783 into #13543: since the #13783 work is now incorporated into #13895, should I still merge #13783 explicitly into #13543, or is #13895 intended to supersede that merge? I also want to confirm whether you’d like me to do any further audit of the remaining explicit allowedValues entries where a corresponding enum may exist, before considering this complete. |
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #13895 +/- ##
=============================================
- Coverage 18.08% 3.41% -14.68%
=============================================
Files 6037 487 -5550
Lines 542580 41867 -500713
Branches 66428 7912 -58516
=============================================
- Hits 98149 1429 -96720
+ Misses 433409 40238 -393171
+ Partials 11022 200 -10822
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 18890 |
|
Description
Refactor API parameter
allowedValuesdiscovery to support enum-backed values.Previously, enum values were specified directly as hard-coded strings in API parameter annotations. This can result in duplicated sources of truth when the corresponding enum changes.
This change introduces
allowedValueTypeto@Parameter. When an enum type is provided, API discovery derives the allowed values directly from the enum constants.The existing explicit
allowedValuesmechanism is retained for parameters that do not have a corresponding enum.The change also expands enum-backed allowed-values coverage across existing API parameters.
Changes
allowedValueTypeto@Parameter.ApiDiscoveryServiceImpl.allowedValuessupport as a fallback.Validation
mvn -pl plugins/api/discovery -am -DskipTests compilemvn -pl plugins/api/discovery -Dtest=ApiDiscoveryServiceImplTest -DfailIfNoTests=false testgit diff --checkAPI Discovery tests: 8/8 passed.